<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<html>
<head>


<script type="text/javascript">
	var listUrl = "message/index.do";
	var messageType;
	$(document).ready(function() {
		messageType = syncGetDictListByTypeName('messageType');
	})
	//end ready

	function saveMessage() {
		//$('#message-fm').birthday 编辑日期表单值，然后提交
		$('#message-fm').form('submit', {
			url : 'rest/messageAdd.do',
			onSubmit : function() {
				var validator = $(this).form('validate');
				if (validator) {
					$.messager.progress();
				}
				return validator;
			},
			success : function(result) {
				$.messager.progress('close');
				var result = eval('(' + result + ')');
				if (result.retCode == '0000') {
					backMessage(listUrl);

				} else {
					$.messager.show({
						title : 'Error',
						msg : result.retMsg
					});
				}
			}
		});
	}

	function backMessage(url) {
		$.get(url, {}, function(data) {
			$("#center").empty();
			$("#center").html(data);
			$.parser.parse($("#center"));
		});
	}
</script>
</head>
<body>
<div class="linkbar"><a>系统</a>/<a>消息模板管理</a>/<a>新增消息模板</a></div>
	<!-- <div class="breadcrumb">系统 &gt;&gt; 消息模板管理 &gt;&gt; 新增消息模板</div> -->
	<div id="div-add" >
		<form id="message-fm" method="post" novalidate>
			<div class="fitem">
				<label>标题:</label> <input name="title"
					class="easyui-validatebox" missingMessage="该输入项不能为空！"
					required="true" />
			</div>
			<div class="fitem">
				<label>类型:</label> 
				<select id="messageType" class="easyui-combobox"
					name="type" style="width:300px;" panelHeight="auto"
					data-options="valueField: 'dictValue',textField: 'dictName',
								data: messageType" />
			</div>	
			<div class="fitem">
				<label>内容:</label> 
				<input name="content"
					   class="easyui-validatebox" 
					   data-options="required:true,validType:['length[1,200]']" />
			</div>
			<div class="fitem">
				<label>备注：</label> 
				<textarea name="remark" style="height:80px;width:300px;"
					   class="easyui-validatebox" 
					   data-options="validType:['length[1,5000]']" />
			</div>
		</form>
	</div>
	<div id="dlg-buttons">
		<a href="#" class="easyui-linkbutton" iconCls="icon-ok"
			onclick="saveMessage()">保存</a> <a href="#" class="easyui-linkbutton"
			iconCls="icon-cancel" onclick="backMessage(listUrl)">返回</a>
	</div>


</body>
</html>